﻿@model RTracker.Models.Common.CPaging

@{
    Int32 nPageSize = Model.PageSize;
    Int64 nNoOfPages = Model.TotalRecordsCount % nPageSize;
    if (nNoOfPages >= 1)
    {
        nNoOfPages = (Model.TotalRecordsCount / nPageSize) + 1;
    }
    else
    {
        nNoOfPages = Model.TotalRecordsCount / nPageSize;
    }
}

@*  /** Grid Controller Starts **/
    "gd-control-cls" : Class contains the properties of GridView Controller.
*@
<div class="gd-control-cls" id="">

    @*  /** Events division Starts **/
        "gb-float-left" : Class is used to align left the Division.
        "event-div-width-cls" : Class assign the width to the event section.
        "box-icon" : Contains the image of box icon visible.
        "gd-event-design-cls" : Class contains the event design.
    *@
    <div class="event-design-cls">
        @if (ViewBag.bNewDeleteEnabled == true)
        {
            @* New Event *@
            if (ViewBag.bCanCreate == true)
            {
                <div class="box-icon">
                    <span id="gd-new-id" class="gd-event-design-cls">New</span>
                </div>
            }
            @* Delete Event *@
            if (ViewBag.bCanDelete == true)
            {
                <div class="box-icon">
                    <span id="gd-delete-id" class="gd-event-design-cls gd-disabled-cls">Delete</span>
                </div>
            }
        }
        @* Copy-Paste Event *@
        <div id="">
            @if (ViewBag.bCopyPasteEnabled == true)
            {
                if (ViewBag.bCanCopy == true)
                {
                    <div class="box-icon">
                        <span id="gd-copy-id" class="gd-event-design-cls gd-disabled-cls">Copy</span>
                    </div>
                }
                if (ViewBag.bCanPaste == true)
                {
                    <div class="box-icon">
                        <span id="gd-paste-id" class="gd-event-design-cls gd-disabled-cls">Paste</span>
                    </div>
                }
            }
        </div>
        @* Copy-Paste Ends *@
    </div>
    @* /** Events division Ends **/ *@
    <div class="page-size-div" style="float:left">
        <select id="sl-gd-page-size-id" class="paging-select">
            <option>5</option>
            <option>10</option>
            <option>15</option>
        </select> Records
    </div>
    @* /** Paging Division Starts **/ *@
    <div class="no-background-image-cls gb-float-right paging-style-cls">
        @if (ViewBag.bPagingEnabled == true)
        {
            <div class="paging-div">
                @* First *@
                <a @if (@Model.PageNumber == 1) { <text> class="gd-disabled-cls gd-text-decoration-cls" </text>       } else { <text> class="gd-text-decoration-cls" </text>      } href="javascript:void(0)" id="ahr-gd-first-id">First</a>

                @* Previous *@
                <a @if (@Model.PageNumber == 1) { <text> class="gd-disabled-cls gd-text-decoration-cls" </text>        } else { <text> class="gd-text-decoration-cls" </text>       } href="javascript:void(0)" id="ahr-gd-prev-id"><</a>
            </div>

            <div class="paging-div margin-left-paging-cls">
                @* GoTo *@
                <select id="sl-gd-page-no-id" class="paging-select">
                    @for (int i = 1; i <= nNoOfPages; i++)
                    {
                        <option>@i</option>
                    }
                </select>
            </div>

            <div class="paging-div">
                @* Next *@
                <a @if (@Model.PageNumber == @nNoOfPages) { <text> class="gd-disabled-cls gd-text-decoration-cls" </text>         } else { <text> class="gd-text-decoration-cls" </text>        } href="javascript:void(0)" id="ahr-gd-next-id">></a>

                @* Last *@
                <a @if (@Model.PageNumber == @nNoOfPages) { <text> class="gd-disabled-cls gd-text-decoration-cls" </text>          } else { <text> class="gd-text-decoration-cls" </text>         } href="javascript:void(0)" id="ahr-gd-last-id">Last</a>
            </div>
        }
    </div>
    @* /** Paging Division Ends **/ *@

    @* Search Division
        "search-style-cls" :Class Contains Search box Design
    *@
    <div class="gb-float-right div-search-style-cls">
        @if (ViewBag.bSearchEnabled == true)
        {
            <input type="search" class="search-style-cls" />
        }
    </div>

</div>


@* Hidden Section Containg the Partial View of Delete And Copy Dialog *@
<div class="gb-hidden-cls">
    @Html.Partial("../GridView/Dialogs/_DeleteDialog")
    @Html.Partial("../GridView/Dialogs/_CopyDialog")
</div>


<script>
    $("#sl-gd-page-no-id").val(@Model.PageNumber);

    $("#sl-gd-page-size-id").val(@Model.PageSize);

    $("#div-current-page-id").html(@Model.PageNumber);

    nGbCurrentPage = @Model.PageNumber

    nGbTotalPages = @nNoOfPages

</script>








